<?php
use \yii\helpers\Url;
use \yii\helpers\Html;
use \common\models\Catalog;
use \common\models\Post;
use \common\models\Banner;
use \common\models\Links;
use yii\bootstrap\BootstrapAsset;
use yii\web\JqueryAsset;
?><!--post-->
<!--/* @description 问题详情 */-->
<?php
$alias=Yii::$app->view->params['alias'];
$navItems = Catalog::getNavItems(3,'question');
if($navItems['childItems']){
    $navItems=$navItems['childItems'];
    if(empty($alias)||$alias=='question') {
        $alias = $navItems[0]['alias'];
    }
}
$photos = Banner::photos('首页');
$cid=$post['catalog_id'];
$pid=$post['id'];
//上一条
$pre=Yii::$app->db->createCommand("SELECT * FROM post WHERE id < '$pid' and catalog_id='$cid' ORDER BY id DESC LIMIT 1 ")->queryOne();
//下一条
$next=Yii::$app->db->createCommand("SELECT * FROM post WHERE id > '$pid' and catalog_id='$cid' ORDER BY id ASC LIMIT 1 ")->queryOne();
?>
<div  class="banner">
    <div class="hd">
        <ul>
            <?php foreach ($photos as $photo){?>
                <li></li>
            <?php }?>
        </ul>
    </div>
    <div class="bd">
        <ul>
            <?php foreach ($photos as $photo){?>
                <li><a href="<?=$photo['url']?$photo['url']:'#'?>"><img src="<?=$photo['src']?>" /></a></li>
            <?php }?>
        </ul>
    </div>
    <a class="prev" href="javascript:void(0)"></a>
    <a class="next" href="javascript:void(0)"></a>
</div>
<script type="text/javascript">
    jQuery(".banner").slide({mainCell:".bd ul",autoPlay:true,effect:"fold",interTime:"2500"});
</script>
<!--<div class="online_box" style="top:733px;">-->
<!--    <img src="/images/online.png">-->
<!--    <div>-->
<!--        <p><img src="/images/online_contact.png"><span>科牌-小燕</span></p>-->
<!--        <p><img src="/images/online_contact.png"><span>科牌-小燕</span></p>-->
<!--    </div>-->
<!--</div>-->
<div class="content wrapper">

    <div class="content_box">
        <div class="product_display clearfix">
            <div class="pull-left">
                <p>常见问题<br><span>QUESTION</span></p>
                <ul>
                    <?php
                    for($i=0;$i<count($navItems);$i++){
                        $nav=$navItems[$i];
                        ?>
                        <li data-url="<?=Url::to(['/catalog','alias'=>$nav['alias']])?>" data-alias="<?=$nav['alias']?>" class="<?=$alias==$nav['alias']?'on':''?>" onclick="skip(this)"><a href="javascript:;"><?=$nav['name']?><span><img src="/images/flag<?=$i+1?>.png"></span></a></li>
                        <?php
                    }
                    ?>
                    <li></li>
                </ul>
            </div>
            <div class="pull-right">
                <div class="pro_detail ">
                    <div class="title clearfix">
                        <p class="pro_tit"><?=$catalog['name']?></p>
                        <p>首 页  >  常见问题  >  <?=$catalog['name']?></p>
                    </div>
                    <div class="news_info_box">
                        <div class="title_box">
                            <p class="title">问：<?=$post['title']?></p>
                            <p class="date">日期：<?=date("Y-m-d",$post['updated_at'])?>   |   阅读：<?=$post['views']?>次</p>
                        </div>
                        <?=$post['content']?>
                    </div>
                    <div class="page_info_box">
                        <a <?php if($pre){ $url=\yii\helpers\Url::to(['/post', 'id' => $pre['id']]);echo 'href="'.$url.'"'; }?>>上一篇:<span><?=empty($pre)?'没有了':$pre['title']?>  </span></a>
                        <a <?php if($next){ $url=\yii\helpers\Url::to(['/post', 'id' => $next['id']]);echo 'href="'.$url.'"'; }?>>下一篇:<span><?=empty($next)?'没有了':$next['title']?></span></a>
                    </div>
                </div>

            </div>

        </div>
    </div>
</div>